package cn.ickck.law_paper_final.mapper;

import cn.ickck.law_paper_final.model.entity.GdbBatch;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @Author: ck
 * @Description:
 * @Date: Create in 15:59 2020/11/28
 */
public interface GdbBatchMapper {
    @Insert("insert into gdb_batch(`name`,`date`,`key`) values(#{name},#{date},#{key})")
    Integer insert(GdbBatch gdbBatch);


    @Select("select count(*) from gdb_batch")
    int count();


    @Select(
            "select * from gdb_batch limit #{start},#{end}"
    )
    List<GdbBatch> selectByPage(int start, int end);


    @Select("select * from gdb_batch where name like  CONCAT('%',#{name},'%')")
    List<GdbBatch> findByName(String name);


    @Delete("delete from gdb_batch where id = #{id}")
    Integer delete(Integer id);


    @Select("select `key` from gdb_batch where id = #{id}")
    String findKeyById(Integer id);
}
